<template>
    <div>
        <div id="J1">
            <div id="J2">
                <el-breadcrumb separator-class="el-icon-arrow-right">
                    <el-breadcrumb-item>当前位置</el-breadcrumb-item>
                    <el-breadcrumb-item>养老服务管理系统</el-breadcrumb-item>
                    <el-breadcrumb-item>机构养老</el-breadcrumb-item>
                    <el-breadcrumb-item>机构管理</el-breadcrumb-item>
                    <el-breadcrumb-item>从业人员信息</el-breadcrumb-item>
                </el-breadcrumb>
            </div>
        </div>
        <!-- 多条件搜索框 -->
        <div id="J3">
            <div id="J4"> <span>机构名称：</span>
                <el-select v-model="fen.jigouId" clearable>
                    <el-option v-for="xinxi in jigouname" :key="xinxi.noid" :label="xinxi.jigouname" :value="xinxi.noid"></el-option>
                </el-select>

                <span style="margin-left: 30px;">姓名：</span>
                <el-input placeholder="请输入内容" v-model="fen.userName" style="width:130px"></el-input>

                <span style="margin-left: 30px;">身份证：</span>
                <el-input placeholder="请输入内容" v-model="fen.userIdcard" style="width:180px"></el-input>

                <span style="margin-left: 30px;">人员类别：</span>
                <el-select v-model="fen.leibie" clearable placeholder="请选择">
                    <el-option label="养老护理员" value="0"></el-option>
                    <el-option label="专业技术人员" value="1"></el-option>
                    <el-option label="社会工作者" value="2"></el-option>
                    <el-option label="其他人员" value="3"></el-option>
                    <el-option label="外包人员" value="4"></el-option>
                    <el-option label="取得消防岗位资格证人员" value="5"></el-option>
                    <el-option label="志愿者" value="6"></el-option>
                    <el-option label="管理人员" value="7"></el-option>
                    <el-option label="工勤人员" value="8"></el-option>
                </el-select>

                <span style="margin-left: 30px;">人员状态：</span>
                <el-select v-model="fen.state" clearable placeholder="请选择">
                    <el-option label="离职" value="0"></el-option>
                    <el-option label="在职" value="1"></el-option>
                </el-select>

                <el-button type="primary" icon="el-icon-search" @click.native="onSubmit" style="margin-left: 50px;">搜索
                </el-button>
            </div>
        </div>
        <!-- 增删改查、分页、页面数据 -->
        <div id="J5">
            <div id="J6">
                <el-button type="success" plain @click.native="xinzeng">新建</el-button>
                <el-button type="primary" plain @click.native="chakan()">查看</el-button>
                <el-button type="warning" plain @click.native="xiugai">修改</el-button>
                <el-button type="danger" plain @click.native="shanchu">删除</el-button>
                <el-button type="danger" plain @click.native="lizhi">离职</el-button>
                <div id="J7">
                    <el-table border ref="multipleTable" :data="tableData" tooltip-effect="dark"
                        style="width: 100%" @selection-change="handleSelectionChange">
                        <el-table-column type="selection" width="55"> </el-table-column>
                        <el-table-column type="index" label="序号" width="100"></el-table-column> 
                        <el-table-column prop="jigouname" label="机构姓名" width="160"> </el-table-column>
                        <el-table-column prop="userName" label="姓名" width="100"> </el-table-column>
                        <el-table-column prop="sex" label="性别" width="100">
                            <template slot-scope="scope">
                                {{scope.row.sex==0?'女':''}}
                                {{scope.row.sex==1?'男':''}}
                            </template>
                        </el-table-column>
                        <el-table-column prop="userIdcard" label="身份证" width="205"> </el-table-column>
                        <el-table-column prop="leibie" label="人员类别" width="220">
                            <template slot-scope="scope">
                                {{scope.row.leibie==0?'养老护理员':''}}
                                {{scope.row.leibie==1?'专业技术人员':''}}
                                {{scope.row.leibie==2?'社会工作者':''}}
                                {{scope.row.leibie==3?'其他人员':''}}
                                {{scope.row.leibie==4?'外包人员':''}}
                                {{scope.row.leibie==5?'取得消防岗位资格证人员':''}}
                                {{scope.row.leibie==6?'志愿者':''}}
                                {{scope.row.leibie==7?'管理人员':''}}
                                {{scope.row.leibie==8?'工勤人员':''}}
                            </template>
                        </el-table-column>
                        <el-table-column prop="isZaibian" label="是否在编" width="220">
                            <template slot-scope="scope">
                                {{scope.row.isZaibian==0?'否':''}}
                                {{scope.row.isZaibian==1?'是':''}}
                            </template>
                        </el-table-column>
                        <el-table-column prop="ruzhiDate" :formatter="leaveTime" label="入职时间" width="220">
                        </el-table-column>
                        <el-table-column prop="state" label="人员状态：" width="200" show-overflow-tooltip>
                            <template slot-scope="scope">
                                {{scope.row.state==0?'离职':''}}
                                {{scope.row.state==1?'在职':''}}
                            </template>
                        </el-table-column>
                    </el-table>
                </div>
                <el-pagination @size-change="xianshi" @current-change="yema" :current-page="fen.dqNum"
                    :page-sizes="[5, 15, 20, 30]" :page-size="fen.xsNum"
                    layout="total, sizes, prev, pager, next, jumper" :total="total">
                </el-pagination>
            </div>
        </div>
        <!-- 新增修改信息模块 ------------------------------------------------------------>
        <el-dialog :title="isAdd?'新增信息':'修改信息'" :visible.sync="dialogFormVisible" :append-to-body="true">
            <el-form :model="congye" :inline="true" :rules="rules" ref="congye">

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="机构名称：" prop="jigouId" label-width="200">
                            <el-select v-model="congye.jigouId" clearable>
                                <el-option v-for="xinxi in jigouname" :key="xinxi.noid" :label="xinxi.jigouname" :value="xinxi.noid"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="姓名：" prop="userName" label-width="200">
                            <el-input v-model="congye.userName" autocomplete="off" placeholder="请输入体检项目名称:"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="性别：" prop="sex" label-width="200">
                            <el-radio-group v-model="congye.sex" >
                                <el-radio :label="1">男</el-radio>
                                <el-radio :label="0">女</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="身份证：" prop="userIdcard" label-width="200">
                            <el-input v-model="congye.userIdcard" autocomplete="off" placeholder="请输入体检项目名称:"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="人员类别：" prop="leibie">
                            <el-select v-model="congye.leibie" clearable placeholder="请选择：">
                                <el-option label="养老护理员" value="0"></el-option>
                                <el-option label="专业技术人员" value="1"></el-option>
                                <el-option label="社会工作者" value="2"></el-option>
                                <el-option label="其他人员" value="3"></el-option>
                                <el-option label="外包人员" value="4"></el-option>
                                <el-option label="取得消防岗位资格证人员" value="5"></el-option>
                                <el-option label="志愿者" value="6"></el-option>
                                <el-option label="管理人员" value="7"></el-option>
                                <el-option label="工勤人员" value="8"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="入职时间：" prop="ruzhiDate">
                            <el-date-picker
                            v-model="congye.ruzhiDate"
                            type="date"
                            placeholder="选择日期">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="民族" prop="minzu">
                            <el-select v-model="congye.minzu" clearable placeholder="请选择：">
                                <el-option label="汉族" value="0"></el-option>
                                <el-option label="维吾尔族" value="1"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="是否在编：" prop="minzu">
                            <el-radio-group v-model="congye.isZaibian" >
                                <el-radio :label="1">是</el-radio>
                                <el-radio :label="0">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="出生日期：">
                            <el-date-picker
                            v-model="congye.birthday"
                            type="date"
                            placeholder="选择日期">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="婚姻情况：" prop="isHunyin">
                            <el-select v-model="congye.isHunyin" clearable placeholder="请选择：">
                                <el-option label="未婚" value="0"></el-option>
                                <el-option label="已婚" value="1"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="政治面貌：">
                            <el-select v-model="congye.zhengzhimianmao" clearable placeholder="请选择：">
                                <el-option label="中共党员" value="0"></el-option>
                                <el-option label="共青团员" value="1"></el-option>
                                <el-option label="无党派民主人士" value="2"></el-option>
                                <el-option label="群众" value="3"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="文化程度：">
                            <el-select v-model="congye.wenhua" clearable placeholder="请选择：">
                                <el-option label="大专" value="0"></el-option>
                                <el-option label="本科" value="1"></el-option>
                                <el-option label="研究生" value="2"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="籍贯：" prop="jiguan" label-width="200">
                            <el-input v-model="congye.jiguan" autocomplete="off"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="家庭住址：" prop="address" label-width="200">
                            <el-input v-model="congye.address" autocomplete="off"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="个人简介：" prop="resume" label-width="200">
                            <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="congye.resume"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="登陆账号：" prop="userCode" label-width="200" v-if="this.vif==true">
                            <el-input v-model="congye.userCode" autocomplete="off"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="密码：" prop="userPassword" label-width="200" v-if="this.vif==true">
                            <el-input v-model="congye.userPassword" autocomplete="off"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <!-- 0超级管理员，1民政局用户，2干休所用户 -->
                        <el-form-item label="角色：" v-if="this.vif==true">
                            <el-select v-model="congye.userIdentity" clearable placeholder="请选择：">
                                <el-option label="超级管理员" value="0"></el-option>
                                <el-option label="民政局用户" value="1"></el-option>
                                <el-option label="干休所用户" value="2"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-form-item label="免冠证件照："  prop="img" label-width="120px">
                    <img style="width: 170px;height: 200px;" :src="zp+congye.zhengjianzhao" fit="fill">
                </el-form-item><br>

                <!-- 上传图片 -->
                <el-form-item label="免冠证件照：" prop="zhengjianzhao" label-width="120px">
                    <el-upload
                    class="avatar-uploader"
                    action="http://upload-z1.qiniup.com/"
                    :show-file-list="false"
                    :data="shuju"
                    :on-success="handleAvatarSuccessimg"
                    :before-upload="beforeAvatarUpload">
                    <!-- :before-upload 判断文件格式   
                         :on-success    文件地址加文件名-->
                    <img v-if="imageUrl" :src="imageUrl" width="200px" height="200px" class="avatar" @click="getToken">
                    <i v-else class="el-icon-plus avatar-uploader-icon" @click="getToken"></i>
                    <div slot="tip" class="el-upload__tip"><span style="color: red;">*
                            </span>只能上传二寸免冠证件照片，jpg/png格式的文件，且不超过500kb</div>
                    </el-upload>
                </el-form-item><br>
                <!-- 上传图片 -->


                <!-- 文件上传 -->
                <el-form-item label="简历：" prop="jianli" label-width="120px">
                    <el-upload
                    class="avatar-uploader"
                    action="http://upload-z1.qiniup.com/"
                    :show-file-list="false"
                    :data="shuju"
                    :on-success="handleAvatarSuccessfile"
                    :before-upload="beforeAvatarUploadfile">
                    <i class="el-icon-plus avatar-uploader-icon" @click="getToken"></i>
                    </el-upload>
                </el-form-item><br>
                <!-- 文件上传 -->

                

            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click.native="dialogFormVisible=false">取 消</el-button>
                <el-button type="primary" @click.native="submitForm('congye')" v-show="isAdd">确 定</el-button>
                <el-button type="primary" @click.native="edicongye" v-show="!isAdd">保 存</el-button>
            </div>
        </el-dialog>
        <!-- 查看模块------------------查看模块 -->
        <el-dialog title="查看" :visible.sync="chakancongye" :append-to-body="true">
            <el-form :model="congye" :inline="true" ref="congye">

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="机构名称：" prop="jigouId" label-width="200">
                            <el-select v-model="congye.jigouId" clearable disabled>
                                <el-option v-for="xinxi in jigouname" :key="xinxi.noid" :label="xinxi.jigouname" :value="xinxi.noid"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="姓名：" prop="userName" label-width="200">
                            <el-input v-model="congye.userName" autocomplete="off" disabled></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="性别：" prop="sex" label-width="200">
                            <el-radio-group v-model="congye.sex" disabled>
                                <el-radio :label="1">男</el-radio>
                                <el-radio :label="0">女</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="身份证：" prop="userIdcard" label-width="200">
                            <el-input v-model="congye.userIdcard" autocomplete="off" disabled></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="人员类别：" prop="leibie">
                            <el-select v-model="congye.leibie" clearable placeholder="请选择：" disabled>
                                <el-option label="养老护理员" value="0"></el-option>
                                <el-option label="专业技术人员" value="1"></el-option>
                                <el-option label="社会工作者" value="2"></el-option>
                                <el-option label="其他人员" value="3"></el-option>
                                <el-option label="外包人员" value="4"></el-option>
                                <el-option label="取得消防岗位资格证人员" value="5"></el-option>
                                <el-option label="志愿者" value="6"></el-option>
                                <el-option label="管理人员" value="7"></el-option>
                                <el-option label="工勤人员" value="8"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="入职时间：" prop="ruzhiDate">
                            <el-date-picker
                            v-model="congye.ruzhiDate"
                            type="date"
                            placeholder="选择日期"
                            disabled>
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="民族" prop="minzu">
                            <el-select v-model="congye.minzu" clearable placeholder="请选择：" disabled>
                                <el-option label="汉族" value="0"></el-option>
                                <el-option label="维吾尔族" value="1"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="是否在编：" prop="minzu">
                            <el-radio-group v-model="congye.isZaibian" disabled>
                                <el-radio :label="1">是</el-radio>
                                <el-radio :label="0">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="出生日期：">
                            <el-date-picker
                            v-model="congye.birthday"
                            type="date"
                            placeholder="选择日期"
                            disabled>
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="婚姻情况：" prop="isHunyin">
                            <el-select v-model="congye.isHunyin" clearable placeholder="请选择：" disabled>
                                <el-option label="未婚" value="0"></el-option>
                                <el-option label="已婚" value="1"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="政治面貌：">
                            <el-select v-model="congye.zhengzhimianmao" clearable placeholder="请选择：" disabled>
                                <el-option label="中共党员" value="0"></el-option>
                                <el-option label="共青团员" value="1"></el-option>
                                <el-option label="无党派民主人士" value="2"></el-option>
                                <el-option label="群众" value="3"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="文化程度：">
                            <el-select v-model="congye.wenhua" clearable placeholder="请选择：" disabled>
                                <el-option label="大专" value="0"></el-option>
                                <el-option label="本科" value="1"></el-option>
                                <el-option label="研究生" value="2"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="籍贯：" prop="jiguan" label-width="200">
                            <el-input v-model="congye.jiguan" autocomplete="off" disabled></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="家庭住址：" prop="address" label-width="200">
                            <el-input v-model="congye.address" autocomplete="off" disabled></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="个人简介：" prop="resume" label-width="200">
                            <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="congye.resume" disabled></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>

                <!-- 图片上传 -->
                <el-form-item label="免冠证件照："  prop="img" label-width="120px">
                    <img style="width: 170px;height: 200px;" :src="zp+congye.zhengjianzhao" fit="fill">
                </el-form-item><br>
                <!-- 图片上传 -->

                

            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click.native="chakancongye=false">确 定</el-button>
            </div>
        </el-dialog>
        <!-- 离职模块 -->
        <!-- <el-dialog title="离职" :visible.sync="lizhimokuai" :append-to-body="true">
            <el-form :model="congye" :inline="true" ref="congye">
                <el-form-item label="离职原因：" prop="lizhiyuanyin" label-width="400">
                    <el-input type="textarea" style="width: 700px;" v-model="congye.lizhiyuanyin" maxlength="300" show-word-limit></el-input>
                </el-form-item>

            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click.native="lizhimokuai=false">确 定</el-button>
            </div>
        </el-dialog> -->



    </div>
</template>

<script>
import axios from 'axios';
import moment from 'moment';
export default {
    methods: {
        chaxun(){
            axios.post("/chain-api/congye/page",this.fen).then(res=>{
                this.tableData = res.data.list;
                this.total = res.data.total;
            })
        },
        xianshi(a) {
            this.fen.xsNum = a;
            this.chaxun();
        },
        yema(a) {
            this.fen.dqNum = a;
            this.chaxun();
        },
        //查询完到第一页
        onSubmit() {
            this.fen.dqNum = 1;
            this.chaxun();
        },
        xinzeng() {
            this.isAdd = true;
            this.vif = true;
            this.dialogFormVisible = true;
            this.congye.jigouId = '';
            this.congye.userName = '';
            this.congye.sex = '';
            this.congye.userIdcard = '';
            this.congye.leibie = '';
            this.congye.ruzhiDate = '';
            this.congye.minzu = '';
            this.congye.isZaibian = '';
            this.congye.birthday = '';
            this.congye.isHunyin = '';
            this.congye.zhengzhimianmao = '';
            this.congye.wenhua = '';
            this.congye.jiguan = '';
            this.congye.address = '';
            this.congye.resume = '';
            this.congye.state = '';
            this.congye.lizhiDate = '';
            this.congye.lizhiyuanyin = '';
            this.congye.userCode = '';
            this.congye.userPassword = '';
            this.congye.userIdentity = '';

            
            this.congye.zhengjianzhao = '';
            this.congye.jianli = '';
        },
        //新增
        addcongye(){
            this.congye.userPassword = this.$md5(this.congye.userPassword,'a1b2c3defg');
            console.log(this.congye.userPassword);
            axios.post("/chain-api/congye/addcongye",this.congye).then(res=>{
                this.dialogFormVisible = false;
                if (res.data.code) {
                    this.$message({
                        showClose: true,
                        message:'新增成功',
                        type: 'success',
                    })
                }else {
                    this.$message({
                        showClose: true,
                        message: '新增失败',
                    })
                }
                this.onSubmit();
            })
        },
        //查看
        chakan(){
            if (this.multipleSelection.length != 1) {
                this.$message.error("请选择一条信息");
                this.chaxun();
            } else {
                this.chakancongye = true;
                let ids = this.multipleSelection[0].noid;
                axios.get("/chain-api/congye/"+ids).then(res=>{
                    this.congye = res.data.data;
                })
            }
            
        },
        //修改回显
        xiugai(){
            if (this.multipleSelection.length != 1) {
                this.$message.error("只能选择一条数据！！！");
                this.chaxun()
            } else {
                this.isAdd = false;
                this.vif = false;
                this.dialogFormVisible = true;
                let ids = this.multipleSelection[0].noid;
                axios.get("/chain-api/congye/"+ids).then(res=>{
                    this.congye = res.data.data;
                })
            }
        },
        //修改
        edicongye(){
            this.dialogFormVisible = false;
            this.congye.userPassword = this.$md5(this.congye.userPassword,'a1b2c3defg');
            console.log(this.congye.userPassword);
            axios.post("/chain-api/congye/xiugaicongye",this.congye).then(res=>{
                if (res.data.code) {
                    this.$message({
                        showClose:true,
                        message:'修改成功',
                        type:'success'
                    })
                } else {
                    this.$message({
                        showClose:true,
                        message:'修改失败',
                    })
                }
                this.onSubmit();
            })
        },
        //批量删除
        shanchu(){
            if (this.multipleSelection.length == 0) {
                this.$message.error("请选择一条信息");
            } else {
                let ids = this.multipleSelection.map(value => value.noid)
                axios.post("/chain-api/congye/shancongye",ids).then(res=>{
                    if (res.data.code>0) {
                        this.$message.success("批量删除成功")
                        this.chaxun()
                    } else {
                        this.$message.error("批量删除失败")
                        this.chaxun()
                    }
                })
            }
        },
        //离职
        lizhi(){
            if (this.multipleSelection.length == 0) {
                this.$message.error("请选择一条信息");
            } else {
                // this.lizhimokuai = true;
                let ids = this.multipleSelection.map(value => value.noid)
                axios.post("/chain-api/congye/lizhi",ids).then(res=>{
                    if (res.data.code > 0) {
                        this.$message.success("批量离职ok")
                        this.chaxun()
                    }else {
                        this.$message.error("批量离职失败")
                        this.chaxun()
                    }
                })
            }
        },


        //多选框
        handleCheckedCitiesChange(value) {
            let checkedCount = value.length;
        },
        //左侧按钮
        handleSelectionChange(val) {
            this.multipleSelection = val;
            // console.log(val);
        },
        //文件上传
        handleRemove(file, fileList) {
            console.log("handleRemove");
            console.log(file, fileList);
        },
        handlePreview(file) {
            console.log("handlePreview");
            window.open(file.response.url)
            console.log(file);
        },
        handleExceed(files, fileList) {
            console.log("handleExceed");
            this.$message.warning(`当前限制选择 1个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`);
        },
        handleAvatarSuccess(res, file) {//成功，获得返回值：文件名
            console.log("handleAvatarSuccess");
            console.log(res.name);
            this.jingfei.tupian = res.name;
        },
        //日期转换显示
        leaveTime(row, column, cellValue, index){
            return moment(cellValue).format('YYYY-MM-DD');
        },



        handleAvatarSuccessfile(res, file) {//文件
            console.log(res);//上传成功后返回值json{"hash":"FphhkBU4u7F36rDb58cqK3fCmloD","key":"testd705686f-d42a-4991-a55f-9b6479f65e55"}
            this.imageUrl = URL.createObjectURL(file.raw);
            this.congye.jianli=res.key;
        },
        handleAvatarSuccessimg(res, file) {//图片
            console.log(res);//上传成功后返回值json{"hash":"FphhkBU4u7F36rDb58cqK3fCmloD","key":"testd705686f-d42a-4991-a55f-9b6479f65e55"}
            this.imageUrl = URL.createObjectURL(file.raw);
            this.congye.zhengjianzhao=res.key; 
        },
        beforeAvatarUpload(file) {//图片
            const isJPG = file.type === 'image/jpeg';
            const isLt2M = file.size / 1024 / 1024 < 2;

            if (!isJPG) {
            this.$message.error('上传头像图片只能是 JPG 格式!');
            }
            if (!isLt2M) {
            this.$message.error('上传头像图片大小不能超过 2MB!');
            }
            return isJPG && isLt2M;
        },
        beforeAvatarUploadfile(file) {//文件
            console.log(file);
            const isWord = file.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
            const isLt2M = file.size / 1024 / 1024 < 2;

            if (!isWord) {
            this.$message.error('上传简历文件只能是Docx格式!');
            }
            if (!isLt2M) {
            this.$message.error('上传不能超过2MB!');
            }
            return isWord && isLt2M;
        },
        getToken(){
            axios.get("/chain-api/wenjianshangchuan/getToken/yanglaopics").then(res=>{
                this.shuju.token = res.data.data.token;
                this.shuju.key = res.data.data.fname;
            });
        },
    },
    data() {
        return {
            fen: {
                jigouId: '',
                userName: '',
                userIdcard: '',
                leibie: '',
                state: '',

                dqNum: 1,
                xsNum: 5,
            },
            vif:false,
            textarea:'',
            isAdd: true,
            radio:'',
            //增改弹框
            dialogFormVisible: false,//取消
            //查看弹框
            chakancongye: false,
            //离职弹框
            lizhimokuai: false,
            //基本表的机构名
            jigouname: [],
            //上传文件
            // fileList: [],
            // bendi:'/chain-api/mystatic/',
            congye: {
                jigouId: '',//机构id 机构名称
                userName: '',//从业人员姓名
                sex: '',//性别  0--女 1--男
                userIdcard: '',//身份证号
                leibie: '',//从业人员类别
                ruzhiDate: '',//入职时间
                minzu: '',//民族
                isZaibian: '',//是否在编  0--否 1--是
                birthday: '',//出生日期
                isHunyin: '',//婚姻状况 0未婚，1已婚
                zhengzhimianmao: '',//政治面貌
                wenhua: '',//文化程度
                jiguan: '',//籍贯
                address: '',//家庭住址
                resume: '',//个人简介
                state: '',//人员状态
                lizhiDate: '',//离职时间
                lizhiyuanyin: '',//离职原因
                userCode: '',//登录账号
                userPassword: '',//密码
                userIdentity: '',//角色
                isDelete: '',//0已删除，1未删除

                zhengjianzhao: '',//证件照片
                jianli: '',//简历上传文件
            },
            //页面总数
            total: 0,
            tableData: [{
                noid: '',
                jigouId: '',
                userName: '',//从业人员姓名
                sex: '',//性别  0--女 1--男
                userIdcard: '',//身份证号
                leibie: '',//从业人员类别
                ruzhiDate: '',//入职时间
                isZaibian: '',//是否在编  0--否 1--是
                state: '',//人员状态
            }],
            //左侧按钮
            multipleSelection: [],

            //图片上传物件
            imageUrl: '',
            shuju:{
                key:"",
                token:""
            },
            zp:"http://rkagcso2x.hb-bkt.clouddn.com/",

            rules: {
                jigouId: [
                    { required: true, message: '请选择机构名称', trigger: 'blur' }
                ],
                userName: [
                    { required: true, message: '请输入从业人员姓名', trigger: 'blur' }
                ],
                sex: [
                    { required: true, message: '请选择男女', trigger: 'blur' }
                ],
                userIdcard: [
                    { required: true, message: '请输入身份证号', trigger: 'blur' }
                ],
                leibie: [
                    { required: true, message: '请选择人员类别', trigger: 'blur' }
                ],
                ruzhiDate: [
                    { required: true, message: '请输入入职时间', trigger: 'blur' }
                ],
            },
            submitForm(formName) {
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        this.addcongye()
                    } else {
                        console.log('error submit!!');
                        return false;
                    }
                });
            },
        }
    },
    mounted() {
        this.chaxun();
        axios.post("/chain-api/jingfeibutie/jibenbiao").then(res=>{
            this.jigouname = res.data
        })
    },

}
</script>

<style>
#J1 {
    padding-top: 15px;
}
#J2 {
    width: 1600px;
    height: 30px;
    padding-left: 10px;
    padding-top: 15px;
    margin: auto;
    background-color: rgb(255, 255, 255);
    /* box-sizing: border-box; */
}
#J3 {
    padding-top: 10px;
}
#J4 {
    width: 1600px;
    height: 60px;
    padding-left: 10px;
    padding-top: 45px;
    margin: auto;
    background-color: rgb(255, 255, 255);
}
#J5 {
    padding-top: 10px;
}
#J6 {
    width: 1585px;
    height: 630px;
    padding-left: 25px;
    padding-top: 45px;
    margin: auto;
    background-color: rgb(255, 255, 255);
}
#J7 {
    /* padding-left: 0px; */
    padding-top: 20px;
    margin: auto;
    background-color: rgb(255, 255, 255);
}
#J8 {
    width: 310px;
    height: 38px;
    /* background-color: red; */
    margin-left: 0px;
    margin-top: 0px;
}

#J9 {
    display: inline;
    width: 282px;
    height: 38px;
    /* background-color: blue; */
    margin-left: 195px;
    margin-top: 0px;
}
.avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }
</style>